//
//  ZYAccountManagementCell.m
//  优学荟管理系统
//
//  Created by Ethan on 2017/9/18.
//  Copyright © 2017年 星道三好. All rights reserved.
//

#import "ZYAccountManagementCell.h"
#import "ZYAccountManagementModel.h"
@implementation ZYAccountManagementCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        
        [self setUpSuperView];
    }
    
    
    return self;
    
}


- (void)assignByZYAccountManagementModel:(ZYAccountManagementModel *)model {
    
    self.teacherLabel.text = [NSString stringWithFormat:@"%@",model.websiteName];
    self.accountNumberLabel.text = [NSString stringWithFormat:@"账号：%@",model.username];
    
}
    
    
- (void)setUpSuperView{
    
    
    self.teacherLabel = [UILabel new];
    //    self.teacherLabel.backgroundColor = [UIColor redColor];
    self.teacherLabel.text =@"优加分机构（绘画区）";
    self.teacherLabel.textColor = ColorRGB(0, 0, 0);
    self.teacherLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView  addSubview:self.teacherLabel];
    
    self.studentButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [self.studentButton setImage:[UIImage imageNamed:@"add_icon_small_more_default"] forState:(UIControlStateNormal)];
    [self.studentButton setTitleColor:ColorRGB(54, 131, 184) forState:(UIControlStateNormal)];
    self.studentButton.titleLabel.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:self.studentButton];
    
    
    self.accountNumberLabel = [UILabel new];
    //    self.accountNumberLabel.backgroundColor = [UIColor orangeColor];
    self.accountNumberLabel.font = [UIFont systemFontOfSize:13];
    self.accountNumberLabel.textColor = ColorRGB(102, 102, 102);
    self.accountNumberLabel.text = @"账号：123456789";
    [self.contentView addSubview:self.accountNumberLabel];
    
    self.passwordLabel = [UILabel new];
    //    self.passwordLabel.backgroundColor = [UIColor greenColor];
    self.passwordLabel.font = [UIFont systemFontOfSize:13];
    self.passwordLabel.textColor = ColorRGB(102, 102, 102);
    self.passwordLabel.text = @"密码：123456";
    [self.contentView addSubview:self.passwordLabel];
    
    
    
    
    [self.teacherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.offset(8);
        make.height.offset(30);
    }];
    
    
    [self.studentButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self).offset(-8);
        make.top.centerY.equalTo(self.teacherLabel);
    }];
    
    UILabel *grayOne = [UILabel new];
    grayOne.backgroundColor = ColorRGB(247,245,245);
    [self.contentView addSubview:grayOne];
    
    [grayOne mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.offset(5);
        make.top.equalTo(self.teacherLabel.mas_bottom).offset(5);
        make.width.offset(SCREEN_WIDTH - 10);
        make.height.offset(1);
    }];
    
    
    [self.accountNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.teacherLabel);
        make.top.equalTo(grayOne.mas_bottom).offset(5);
        make.height.equalTo(self.teacherLabel);
    }];
    
    
//    UILabel *grayTow = [UILabel new];
//    grayTow.backgroundColor = ColorRGB(247,245,245);
//    [self.contentView addSubview:grayTow];
//    
//    [grayTow mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.left.equalTo(grayOne);
//        make.top.equalTo(self.accountNumberLabel.mas_bottom).offset(5);
//        make.width.equalTo(grayOne);
//        make.height.equalTo(grayOne);
//    }];
    
    
    
//    [self.passwordLabel mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(self.accountNumberLabel);
//        make.top.equalTo(grayTow.mas_bottom).offset(5);
//        make.height.equalTo(self.accountNumberLabel);
//    }];
    
    UILabel *grayThree = [UILabel new];
    grayThree.backgroundColor = ColorRGB(247,245,245);
    [self.contentView addSubview:grayThree];
    
    [grayThree mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.offset(0);
        make.top.equalTo(self.accountNumberLabel.mas_bottom).offset(8);
        make.width.offset(SCREEN_WIDTH);
        make.height.offset(15);
        
        
    }];
    
    
    [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
        make.bottom.mas_equalTo(grayThree).offset(0);
    }];
    
    
    
    
    
    
    
    
}

@end
